package com.morpheus.redis.redisson.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

import lombok.Data;

@Data
@ConfigurationProperties(prefix = "spring.redis.redisson")
public class RedissonProperties {
	private String config = null;
	private Connection connection = null;
	private Retry retry = null;
	private Subscription subscription = null;
	private JMX jmx = null;
	private Test test = null;
	private String readMode = null;

	@Data
	public static class Connection {
		private Master master = null;
		private Slave slave = null;

		private int pingInterval = 0;
		private int idleTimeout = 0;

		@Data
		public static class Master {
			private int poolSize = 0;
			private int minimumIdleSize = 0;
		}

		@Data
		public static class Slave {
			private int poolSize = 0;
			private int minimumIdleSize = 0;
		}
	}

	@Data
	public static class Retry {
		private int attempts = 0;
		private int interval = 0;
	}

	@Data
	public static class Subscription {
		private int connectionMinimumIdleSize = 0;
		private int connectionPoolSize = 0;
		private String mode = null;
		private int subscriptionsPerConnection = 0;
	}

	@Data
	public static class JMX {
		private boolean enabled = false;
		private Name name = null;

		@Data
		public static class Name {
			private String base = null;
			private String prefix = null;
		}
	}

	@Data
	public static class Test {
		private boolean onBorrow = true;
		private boolean onCreate = false;
		private boolean onReturn = false;
		private boolean whileIdle = true;
	}
}
